package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.TestSoulResult;
import com.itheima.mapper.TestSoulResultMapper;
import com.itheima.service.db.TestSoulResultService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class TestSoulResultServiceImpl implements TestSoulResultService {
    @Autowired
    TestSoulResultMapper testSoulResultMapper;

    @Override
    public TestSoulResult findResultByScore(Integer userScore) {
        LambdaQueryWrapper<TestSoulResult> lqw = new LambdaQueryWrapper<>();
        lqw.ge(TestSoulResult::getMax,userScore).le(TestSoulResult::getMin,userScore);
        return testSoulResultMapper.selectOne(lqw);
    }

    @Override
    public TestSoulResult findById(Long resultId) {
        return testSoulResultMapper.selectById(resultId);
    }
}
